package yxy.game.pm2.module.passbarrier;

import yxy.game.pm2.bean.PlayerBean;
import yxy.game.pm2.bean.ServerBean;
import yxy.game.pm2.bean.area.AreaBean;
import yxy.game.pm2.bean.area.AreaGroupBean;
import yxy.game.pm2.bean.module.rank.AreaGroupRankModule;
import yxy.game.pm2.bean.module.rank.PlayerRankModule;

/****************************************
 * @name PassbarrierRank
 * @description 斩关夺隘排行榜
 * @author 梁健彬
 * @since 2022-09-05
 ***************************************/
public class PassbarrierRank extends AreaGroupRankModule {

    public static int currentDayScore = 0;      //当天
    public static int totalScore = 1;           //全部总和

    private int type; // 区分当天和总共

    public PassbarrierRank(AreaGroupBean areaGroupBean, int type){
        super(areaGroupBean);
        this.type = type;
        initInfo();
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    @Override
    public String rankName() {
        return PlayerRankModule.getAllRankNames().get(23);
    }

    @Override
    protected long valuePlastic(long value) {
        return value ;//
    }

    @Override
    protected long valueRestore(long score) {
        return score ;
    }

    @Override
    public int topSize() {
        return 50;
    }

    @Override
    protected String rankKey() {
        return String.format("PASSBARRIER:AREAGROUP:%s:PASSBARRIER:%s",getAreaGroupId(),getType());
    }

    static public PassbarrierRank getRank(String playerCode, int type){
        PlayerBean playerBean = PlayerBean.get(playerCode);
        ServerBean serverBean = ServerBean.get(playerBean.getServerId());
        AreaBean areaBean = AreaBean.get(serverBean.getAreaId());
        AreaGroupBean areaGroupBean = AreaGroupBean.get(areaBean.getGroupId());
        return new PassbarrierRank(areaGroupBean,type);
    }

    static public PassbarrierRank getRank(AreaGroupBean areaGroupBean, int type){
        return new PassbarrierRank(areaGroupBean,type);
    }
}
